package Practice3;

public class Cylinder extends Circle{
    private double height;
    public Cylinder(double radius,double theheight) {
        super(radius);
        if(theheight <= 0) {
            this.height = 1.0;
        }else {
            this.height = theheight;
        }
    }
    public double getHeight() {
        return height;
    }
    public void setHeight(double height) {
        if (height <= 0) {
            this.height = 1.0;
        }else{
            this.height = height;
        }
    }
    public double findVolume() {
        return height*getArea();
    }
    public void print() {
        System.out.println("圆柱的面积为"+findVolume());
    }
}
